<style>
.ui-li-aside {
    width: 100px;
}
.ui-li-desc {
    display: block;
    font-size: 12px;
    font-weight: normal;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
}
</style>

<!-- Start of first page -->
<div data-role="page">
		<div data-role="header" data-theme="b">
			<h1>iLook-<?php echo $bbs->title?></h1>
			<?php if(yii::app()->user->isGuest){
				echo CHtml::link("首页",array("site/index"),array("data-role"=>"button","data-icon"=>"home",'rel'=>'external'));
				echo CHtml::link("登陆",array("site/login"),array("data-icon"=>"star"));
			}elseif($bbs->id !=1){
				echo CHtml::link("首页",array("site/index"),array("data-role"=>"button","data-icon"=>"home",'rel'=>'external'));
				echo CHtml::link("新帖",array("bbs/new","id"=>"$bbs->id"),array("data-icon"=>"plus",'rel'=>'external'));
			}else{
				echo CHtml::link("首页",array("site/index"),array("data-role"=>"button","data-icon"=>"home",'rel'=>'external'));
				echo CHtml::link("注销",array("site/logout"),array("data-icon"=>"delete"));		
			}
			?>
		</div>
		<!-- /header -->
		

		<div data-role="footer">
		<div data-role="navbar" data-theme="e" >
			<ul>
				<?php if($bbs->id !=1):?>
				<li><?php echo CHtml::link("热帖",array("bbs/list"),array("data-icon"=>"star","data-theme"=>"b"))?></li>
				<?php else:?>
				<li><?php echo CHtml::link("热帖",array("bbs/list"),array("data-icon"=>"star","data-theme"=>"e"))?></li>
				<?php endif?>
				<li><?php echo CHtml::link("分版",array("bbs/category"),array("data-icon"=>"grid","data-theme"=>"b"))?></li>
				<li><?php echo CHtml::link("用户",array("user/index"),array("data-icon"=>"star","data-theme"=>"b"))?></li>
				<li><?php echo CHtml::link("地图",array("site/index#sitemap"),array("data-icon"=>"search","data-theme"=>"b",'rel'=>'external'))?></li>
			</ul>
		</div><!-- /navbar -->
		</div><!-- /footer -->

		
		<ul data-role="listview"data-theme="d">
			<?php foreach($topics as $topic):?>
			<li><a rel='external' href="<?php echo Yii::app()->createUrl('bbs/view', array('id'=>$topic->id)); ?>">	
					<div class="tie-list-title">
					<?php if($bbs->id == 1){echo "[".$topic->category."]";}
						if($bbs->id != 1 && $topic->updated=="2030-10-19 13:09:50"){echo "<font color = red>[置顶]</font>";} 
						if($topic->flag == 'featured'){echo "<font color = red>[精品]</font>";}
						$words_count=Utils::gettitleWordCount();
						if($bbs->id == 1 && mb_strlen($topic->title,"UTF-8")>$words_count+3){
							echo mb_substr($topic->title, 0,$words_count-3,"UTF-8")."...";
						}elseif(mb_strlen($topic->title,"UTF-8")>$words_count+3){
							echo mb_substr($topic->title, 0,$words_count,"UTF-8")."...";
						}else{
							echo mb_substr($topic->title, 0,$words_count+3,"UTF-8");
						}
						?>
					</div>
					<div class="ui-grid-a tie-list-footer">
						<div class="ui-block-a"><?php echo $topic->hits?>阅读<?php echo $topic->comments?>回复</div>
						<div class="ui-block-b" style ="text-align:right"><?php echo mb_substr($topic->created,0,16,"UTF-8");?></div>
					</div><!-- /grid-a -->
			</a></li>
			<?php endforeach?>
		</ul>
		
		<?php if($pages->pageCount>1):?>
					<div data-role="controlgroup" data-type="horizontal" style="margin-left:10px;">
					<?php
					$currentPage = $pages->currentPage+1;
					echo CHtml::link("首页",array("","id"=>$bbs->id,"page"=>1), array("data-role"=>"button",'rel'=>'external'));
					for($i=$currentPage-2;$i<=$currentPage+1;$i++){
						if($i<1 || $i>$pages->pageCount){
							continue;
						}
						if($i==$currentPage){
							echo CHtml::link($i,array("","id"=>$bbs->id,"page"=>$i), array("data-role"=>"button","data-theme"=>'b','rel'=>'external'));
						}else{
							echo CHtml::link($i,array("","id"=>$bbs->id,"page"=>$i), array("data-role"=>"button",'rel'=>'external'));
						}
					}
					echo CHtml::link("末页($pages->pageCount)",array("","id"=>$bbs->id,"page"=>$pages->pageCount), array("data-role"=>"button",'rel'=>'external'));
					?>
					</div>
		<?php endif?>
		

		<!--/content-primary -->

		<?php $this->renderPartial("//site/footer")?>
		<!-- /footer -->
</div>
<!-- /page -->